<template>
  <table-box-inline-custom-column
    v-bind="$attrs"
    :props="pps.props"
    :editComponent="FormSelectStudentAI"
  >
    <template #default="{ row }">
      <span>{{ getShowValue(row) }}</span>
    </template>
  </table-box-inline-custom-column>
</template>

<script setup lang="ts">
import FormSelectStudentAI from './index.vue';

const pps = withDefaults(
  defineProps<{
    fieldName: string;
    props?: object;
  }>(),
  {
    props: () => {
      return {
        label: 'showName',
        value: 'userId',
      };
    },
  },
);

const emit = defineEmits(['change']);

const onChange = (value, row) => {
  emit('change', value, row);
};

const getShowValue = row => {
  if (row == null) return '';
  if (row[pps.fieldName + 'DictMap']) {
    return row[pps.fieldName + 'DictMap'].name;
  }
  return row[pps.fieldName];
};
</script>
